<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <title>dc-example</title>
    <script src="/libs/dc-sdk/dc.min.js"></script>
    <link href="/libs/dc-sdk/dc.min.css" type="text/css" rel="stylesheet" />
    <link href="../index.css" type="text/css" rel="stylesheet" />
  </head>

  <body>
    <div id="viewer-container" class="viewer-container"></div>
    <script>
      DC.config.baseUrl = '../libs/dc-sdk/resources/'
      let viewer = new DC.Viewer('viewer-container')
      let baseLayer = DC.ImageryLayerFactory.createImageryLayer(
        DC.ImageryType.AMAP,
        {
          style: 'img',
          crs: 'WGS84',
        }
      )
      viewer.addBaseLayer(baseLayer)
      let layer = new DC.TilesetLayer('layer')
      viewer.addLayer(layer)
      let tileset = new DC.Tileset(
        '//resource.dvgis.cn/data/3dtiles/ljz/tileset.json'
      )
      let style = new DC.TilesetStyle()
      style.color = {
        conditions: [
          ['${Height} >= 300', 'rgba(45, 0, 75, 0.5)'],
          ['${Height} >= 200', 'rgb(102, 71, 151)'],
          ['${Height} >= 100', 'rgb(170, 162, 204)'],
          ['${Height} >= 50', 'rgb(224, 226, 238)'],
          ['${Height} >= 25', 'rgb(252, 230, 200)'],
          ['${Height} >= 10', 'rgb(248, 176, 87)'],
          ['${Height} >= 5', 'rgb(198, 106, 11)'],
          ['true', 'rgb(127, 59, 8)'],
        ],
      }
      tileset.setStyle(style)
      layer.addOverlay(tileset)
      viewer.flyTo(tileset)
    </script>
  </body>
</html>
